home *** CD-ROM | disk | FTP | other *** search
/ Technotools / Technotools (Chestnut CD-ROM)(1993).ISO / lang_c / msqc25t1 / tbox.c < prev    next >
C/C++ Source or Header  |  1990-09-27  |  1KB  |  52 lines

  1. /* tbox.c: Outlining windows with text boxes */
  2.  
  3. #include <conio.h>
  4. #include <graph.h>
  5. #include "textscrn.h"
  6.  
  7. /* Constants */
  8. #define MAINFORE YELLOW
  9. #define MAINBACK BROWN
  10. #define MSSGFORE BLACK
  11. #define BOXFORE  WHITE
  12. #define BOXBACK  RED
  13.  
  14. main()
  15. {
  16.     int n;
  17.     void prompt (char*);
  18.  
  19.     /* Set up main window, double border */
  20.     _savescrn (0);                          /* save entry screen */
  21.     _setbordwindow (2, 2, 22, 79, 2, MAINFORE, MAINBACK);
  22.  
  23.     for (n = 1; n < 22; n++) {          /* write some test */
  24.         _settextposition (n, n + 5);
  25.         _outtextf ("This is at row %d, column %d", n, n + 5);
  26.     }
  27.     prompt ("Press any key for pop-up...");
  28.  
  29.     /* Make a pop-up, single border */
  30.     _savescrn(0);                           /* save display */
  31.     _setbordwindow (10, 28, 10, 52, 1, BOXFORE, BOXBACK);
  32.     _outtext ("This is a pop-up window");
  33.  
  34.     /* Hold pop-up until keypress */
  35.     prompt ("Press any key to restore original screen...");
  36.     _restscrn(0);                                           /* restore */
  37.  
  38.     /* Shut down */
  39.     prompt ("Press any key to quit...");
  40.     _restscrn(0);                       /* restore entry screen */
  41. }
  42.  
  43. void prompt (char *mssg)
  44. {                       /* write message to command line and wait */
  45.  
  46.     _setbordwindow (24, 1, 24, 80, 0, MSSGFORE, MAINBACK);
  47.     _outtext (mssg);
  48.     getch();
  49. }
  50.  
  51.  
  52.